function UnitTests:TestDoorCollapseSimpleDeadlockFiltering()

	-- test deadlock filtering when door collpase
	
	local stage =
	{
		-- we do a grid of 4 rooms as this :
		--
		--	R1 R2
		--	R3 R4
		
		Rooms =
		{
			Room1 =
			{			
			},
			
			Room2 =
			{	
			},
			
			Room3 =
			{	
			},
			
			Room4 =
			{	
			},								
		},
		
		
		-- there are two doors per room. 4 doors in total (defined clockwise)
		
		Doors =
		{
			{
				Rooms = 
				{
					"Room1",
					"Room2"
				},
				
				ClosedAndLocked = true	
			},
			
			{
				Rooms = 
				{
					"Room2",
					"Room4"
				},
				
				ClosedAndLocked = true		
			},
			
			{
				Rooms = 
				{
					"Room4",
					"Room3"
				},
				
				ClosedAndLocked = true		
			},
			
			{
				Rooms = 
				{
					"Room3",
					"Room1"
				},
				
				ClosedAndLocked = true		
			},
		}		
	}
	
	local cast =
	{
		Player =
		{
			initialLocation = "Room1"
		},
	}	

	local game = Game:new(stage, cast)
	
	local room1 = gField.entityTypes.Location.Room1
	local room2 = gField.entityTypes.Location.Room2
	local room3 = gField.entityTypes.Location.Room3
	local room4 = gField.entityTypes.Location.Room4
	
	local key12 = gField.entityTypes.Key["Room1<->Room2"]
	local key24 = gField.entityTypes.Key["Room2<->Room4"]
	local key43 = gField.entityTypes.Key["Room4<->Room3"]
	local key31 = gField.entityTypes.Key["Room3<->Room1"]
	
	local door12 = gField.entityTypes.Door["Room1<->Room2"]
	local door24 = gField.entityTypes.Door["Room2<->Room4"]
	local door43 = gField.entityTypes.Door["Room4<->Room3"]
	local door31 = gField.entityTypes.Door["Room3<->Room1"]

	
	-- all doors biased to collapse closed
	 
	gRandom:addContextualBias({"Door", "Room1<->Room2", "EnablingSteps"}, Door.LockedStep)
	gRandom:addContextualBias({"Door", "Room2<->Room4", "EnablingSteps"}, Door.LockedStep)
	gRandom:addContextualBias({"Door", "Room4<->Room3", "EnablingSteps"}, Door.LockedStep)
	gRandom:addContextualBias({"Door", "Room3<->Room1", "EnablingSteps"}, Door.LockedStep)


	-- all key biased to appear in room 1
		
	gRandom:addContextualBias({"Key", "Room1<->Room2", "CurrentContainer"}, room1)
	gRandom:addContextualBias({"Key", "Room2<->Room4", "CurrentContainer"}, room1)
	gRandom:addContextualBias({"Key", "Room4<->Room3", "CurrentContainer"}, room1)
	gRandom:addContextualBias({"Key", "Room3<->Room1", "CurrentContainer"}, room1)


	-- explore room1->room2->room1->room3
		
	gGame:start()
	
	assert(key12:isIn(room1))				-- all keys collapse in room1
	assert(key24:isIn(room1))
	assert(key43:isIn(room1))
	assert(key31:isIn(room1))

	assert(not door12:isEnabled(true))		-- all doors must collaspe closed because there are no dead locks with all keys in room 1
	assert(not door31:isEnabled(true))
		
	door12:enable()					-- we open the door inbetween room 1 & 2 to allow access to the keys that are in room 1
	gGame:onBeat()
	
	gPlayer.body:execute("moveTo", room2)
	gGame:onBeat()
		
	assert(not door24:isEnabled(true))
	
	gPlayer.body:execute("moveTo", room1)
	gGame:onBeat()
	gPlayer.body:execute("moveTo", room3)
	gGame:onBeat()
	
	assert(door43:isEnabled(true))			-- door as been kept open even if biased to be closed. This is because the key was not accessible because it is in room 1  (in real circonstances, the door from room 3 to room 1 should have been open by the player to go in room 3
	
end